<?php
namespace Admin\Form;

use RoleUser\Entity\RoleUserLinker as RoleUserLinkerEntity;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;
use Zend\Stdlib\Hydrator\ClassMethods;

class RoleUserFieldset extends Fieldset  implements InputFilterProviderInterface
{
    public function __construct()
    {
        parent::__construct('role_user_linker');

        $this
            ->setHydrator(new ClassMethods())
            ->setObject(new RoleUserLinkerEntity())
        ;

        $this->add(array(
            'type' => 'select',
            'name' => 'role_id',
            'required' => true ,
            'options' => array(
                'label' => 'Role',
                'value_options' => array(
                    '0' => 'Guest',
                    '1' => 'Admin' ,
                    '2' => 'User'
                ),//$this->getOptionsForRoles(),
            ),
            'attributes' => array(
                'class' => 'form-control col-xs-12',
                'placeholder' => 'Role'
            ),
        ));
    }

    /**
     * @return array
     */

    public function getInputFilterSpecification() {
        return array(
            'role_id' => array(
                'required' => true,
            ),
        );
    }
} 